package com.industrial.white.util;

import java.util.HashSet;
import java.util.Set;

public class CommonUtil {

    public static final String CITY = "s_01_011";
    public static final String COUNTY = "x_01_011";
    public static final String PROVINCE = "p_01_011";

    public static Set<String> enterField = new HashSet<>();
    public static Set<String> proectField = new HashSet<>();

    static {
        proectField.add("proName");
        proectField.add("proSpecs");
        proectField.add("proDfp");
        proectField.add("proAc");
        proectField.add("proDomain");
        proectField.add("proSupplier");
        proectField.add("proUser");

        enterField.add("enterName");
        enterField.add("enterUsci");
        enterField.add("enterProvince");
        enterField.add("enterCity");
        enterField.add("enterCounty");
        enterField.add("enterSpecificAddress");
        enterField.add("enterContactTitle");
        enterField.add("enterContactsPhone");
        enterField.add("enterType");
        enterField.add("enterScale");
        enterField.add("enterCategory");
        enterField.add("enterRfi");
    }

    public static String underlineToCamel(String underlineStr) {
        StringBuilder result = new StringBuilder();
        String[] words = underlineStr.split("_");

        for (int i = 0; i < words.length; i++) {
            String word = words[i];
            if (i == 0) {
                result.append(word);
            } else {
                result.append(Character.toUpperCase(word.charAt(0)));
                if (word.length() > 1) {
                    result.append(word.substring(1));
                }
            }
        }

        return result.toString();
    }

}
